#include "WiiRemoteFunctionLibrary.h"
#include "WiiRemoteDeviceModule.h"

bool UWiiRemoteFunctionLibrary::Connect()
{
    FWiiRemoteDevice* wiiDevice = FWiiRemoteDeviceModule::GetWiimoteDeviceSafe();

    if (wiiDevice)
    {
        return wiiDevice->Connect();
    }

    return false;
}

void UWiiRemoteFunctionLibrary::Disconnect()
{
    FWiiRemoteDevice* wiiDevice = FWiiRemoteDeviceModule::GetWiimoteDeviceSafe();

    if (wiiDevice)
    {
        wiiDevice->Disconnect();
    }
}

void UWiiRemoteFunctionLibrary::SetIREnabled(int32 ControllerId, bool IsEnabled)
{
    FWiiRemoteDevice* wiiDevice = FWiiRemoteDeviceModule::GetWiimoteDeviceSafe();

    if (wiiDevice)
    {
        wiiDevice->SetIREnabled(ControllerId, IsEnabled);
    }
}

void UWiiRemoteFunctionLibrary::SetMotionPlusEnabled(int32 ControllerId, bool IsEnabled)
{
    FWiiRemoteDevice* wiiDevice = FWiiRemoteDeviceModule::GetWiimoteDeviceSafe();

    if (wiiDevice)
    {
        wiiDevice->SetMotionPlusEnabled(ControllerId, IsEnabled);
    }
}

void UWiiRemoteFunctionLibrary::SetMotionSensingEnabled(int32 ControllerId, bool IsEnabled)
{
    FWiiRemoteDevice* wiiDevice = FWiiRemoteDeviceModule::GetWiimoteDeviceSafe();

    if (wiiDevice)
    {
        wiiDevice->SetMotionSensingEnabled(ControllerId, IsEnabled);
    }
}

void UWiiRemoteFunctionLibrary::SetRumbleEnabled(int32 ControllerId, bool IsEnabled)
{
    FWiiRemoteDevice* wiiDevice = FWiiRemoteDeviceModule::GetWiimoteDeviceSafe();

    if (wiiDevice)
    {
        wiiDevice->SetRumbleEnabled(ControllerId, IsEnabled);
    }
}